import { Facade } from "../libs/lightMVC/core/Facade";
import PlayerModel, { ShowroomType } from "./model/PlayerModel";
import PostmodernismMediator from "./postmodernism/PostmodernismMediator";
import PostmodernismView from "./postmodernism/PostmodernismView";
import AudioUtil from "../libs/lightMVC/util/AudioUtil";
import WeChatUtils from "./standar/utils/WeChatUtils";
import TopMediator from "./top/TopMediator";
import TopView from "./top/TopView";



const { ccclass, property } = cc._decorator;

@ccclass
export default class Application extends cc.Component {

    onLoad() {

        // if (CC_DEBUG) {
        //     cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE);
        //     let canvas = cc.find('Canvas').getComponent(cc.Canvas);
        //     canvas.designResolution = cc.winSize;
        // }

        cc.dynamicAtlasManager.enabled = false;
    }

    start() {

        const self = this;

        //初始化框架
        Facade.getInstance().init(false, cc.size(750, 1448), false, true);      //这个分辨率扣除了微信顶部栏和IPhone顶部状态栏

        //注册数据对象
        this.initModel();        

        Facade.getInstance().addLayer(TopMediator, TopView, 1, "");
        //打开第一个界面
        Facade.getInstance().openView(PostmodernismMediator, PostmodernismView, "");

        //测试界面，图片详情窗口
        this.scheduleOnce(function () {

       //     Facade.getInstance().popView(PopImageDetailMediator, PopImageDetailView, "");
        }, 1);


        //Facade.getInstance().getModel(PlayerModel).getPlayer().showroomType = ShowroomType.Person;      //强行标记为个人馆
    }

/**
 *注册数据对象
 */
    initModel(): void {

        Facade.getInstance().registerModel(PlayerModel);
    }
}
